package service;

import dao.CurrentTaskDao;
import essenceClasses.CurrentTask;
import interfaceService.ICurrentTaskService;
import model.TaskState;

import java.sql.SQLException;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: user
 * Date: 01.06.14
 * Time: 12:19
 * To change this template use File | Settings | File Templates.
 */
public class CurrentTaskService implements ICurrentTaskService {
    CurrentTaskDao currentTaskDao = null;

    public CurrentTaskService() {
        currentTaskDao = new CurrentTaskDao();
    }

    @Override
    public boolean addCurrentTask(int taskID, int creatorID, String status, int recepientID) throws SQLException {
        return currentTaskDao.addCurrentTask(taskID, creatorID, status, recepientID);  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public List<CurrentTask> getCurrentTasksById(int taskID) throws SQLException {
        return currentTaskDao.getCurrentTasksById(taskID);  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public List<CurrentTask> getCurrentTasksByCreatorId(int id) throws SQLException {
        return currentTaskDao.getCurrentTasksByCreatorId(id);  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public List<CurrentTask> getCurrentTasksByRecepientId(int id) throws SQLException {
        return currentTaskDao.getCurrentTasksByRecepientId(id);  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public boolean deleteCurrentTaskById(int id) throws SQLException {
        return currentTaskDao.deleteCurrentTaskById(id);  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public boolean changeStateCurrentTaskById(int id, int state) throws SQLException {
        return currentTaskDao.changeStateCurrentTaskById(id, state);  //To change body of implemented methods use File | Settings | File Templates.
    }

    public List<CurrentTask> getCurrentTaskByState(TaskState ts)throws SQLException{
        return currentTaskDao.getCurrentTaskByState(ts);

    }
}
